<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Administratie Systeem</title>
<link rel="stylesheet" href="styles.css" type="text/css" />
<link href="css/bootstrap.css" rel="stylesheet">
<script language="javascript" type="text/javascript" src="js/jquery.js"></script>
<script language="javascript" type="text/javascript" src="js/bootstrap.js"></script>
    <style type="text/css">
      body {
        padding-top: 60px;
        padding-bottom: 40px;
      }
      .sidebar-nav {
        padding: 9px 0;
      }
    </style>
</head>
<body>
<?php include 'check.php'; 

$username     = 'root';
$password     = 'robinLL133';
$host        = 'localhost';
$database    = 'cms';

if(mysql_connect($host,$username,$password))
{
    if(!mysql_select_db($database))
    {
        echo '<div class="alert alert-error">Sorry, ik kon helaas geen verbinding maken met de databasetabel!</div>';
    }
}else{
    echo '<div class="alert alert-error">Sorry, ik kon helaas geen verbinding maken met de databaseserver!</div>';
}

?>

<div id="container1">
  <div id="header">
    <h1><span class="o">Admin</span><span class="db">Paneel</span></h1>
    <h2></h2>
  </div>
  <div id="nav">
    <div class="navbar">
		<div class="navbar-inner">
			<div class="container">
				<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
				</a>
				<a class="brand" href="#">Admin paneel</a>
				<div class="nav-collapse">
					<ul class="nav">
						<li class="active"><a href="index.php">home</a></li>
						<li><a href="admin.php">Pagina beheer</a></li>
						<li><a href="veranderen.php">home pagina veranderen</a></li>
    </ul>
					<p class="navbar-text pull-right">Ingelogd als <a><?php echo $_SESSION["username"]; ?></a></p>
				</div>
			</div>
		</div>
	</div>
  </div>
  <div id="content">
    <div id="main">
      <div class="page-header">
		<h1>Welkom in het admin paneel</h1>
	  </div><p>
	     <?php 
                        if(isset($_GET['msg']))
                        {
                            if($_GET['msg'] == 'succes')
                            {
                                echo '<div class="alert alert-success">U bent succesvol ingelogd!</div>';
                            }
                        } 
				
                    ?>

	  
	  </p>
</div>

    <div id="sidebar">
	  <div class="well sidebar-nav">
            <ul class="nav nav-list">
              <li class="nav-header">Menu van de site</li>

			  
			 
        
	  
<?php
$query         = "SELECT titel, paginaid, volgordeid FROM content ORDER BY volgordeid";
$resultaat     = mysql_query($query);

$menuvolgordeid = 0;

if($resultaat && mysql_num_rows($resultaat) >= 1)
{
    while($rij = mysql_fetch_array($resultaat))
    {
        $menupaginaid     = $rij['paginaid'];
        $menutitel         = $rij['titel'];
        $menuvolgordeid    = $rij['volgordeid'];
        
        if(strlen($menutitel) > 20)
        {
            $menutitel         = substr($menutitel, 0, 17);
            $menutitel        .= "...";
        }
                
        echo '<li>
			  <div class="btn-group">
  <button class="btn dropdown-toggle" data-toggle="dropdown">'.ucfirst($menutitel).'<span class="caret"></span></button>
          
  <ul class="dropdown-menu">
				<a href="admin.php?actie=verhogen&amp;volgordeid='.$menuvolgordeid.'"><i class="icon-chevron-up"></i>menu volgorde omhoog</a> 
				<a href="admin.php?actie=verlagen&amp;volgordeid='.$menuvolgordeid.'"><i class="icon-chevron-down"></i>menu volgorde omlaag</a>
				<a href="admin.php?actie=verwijderen&amp;paginaid='.$menupaginaid.'"><i class="icon-trash"></i>pagina verwijderen</a> 
				<a href="admin.php?actie=wijzigen&amp;paginaid='.$menupaginaid.'"><i class="icon-edit"></i>pagina veranderen</a>
				  </ul>
</div>
			  </li>
			   <li class="divider"></li>';
    }
}    
?>
   <li class="nav-header">Pagina toevoegen</li>
      
	  <?php
echo '<li><a href="admin.php?actie=toevoegen&amp;volgordeid='.($menuvolgordeid +1).'"><i class="icon-pencil"></i>Pagina toevoegen</a></li>';
?>
</ul>
          </div><!--/.well -->

</div>
    <div class="clr"></div>
  </div>
  <div id="footer">
    <p>&copy; Copyright 2007</p>
    <p>Design: <a href="http://www.spyka.net">spyka.net</a></p>
  </div>
</div>
</body>
</html> 